package org.mapwar.service.rest;

import org.mapwar.common.tools.Reply;
import org.mapwar.service.common.request.FirstBody;
import org.mapwar.service.core.FirstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by zhebinwang on 2017/9/27.
 */
@Controller
@RequestMapping(value = "/v1")
public class FirstController {

    private static final Logger logger = LoggerFactory.getLogger(FirstController.class);

    @Autowired
    private FirstService firstService;

    //获取页面列表
    @RequestMapping(value="/domt",
            method = RequestMethod.POST,
            produces = {MediaType.APPLICATION_JSON_VALUE},
            consumes = {MediaType.APPLICATION_JSON_VALUE}
    )
    @ResponseBody
    public Reply machineFactories(@RequestBody FirstBody firstBody) {

        logger.debug("into rest api /domt ");
        int f=firstService.getFirstCount();

        return new Reply().setErrorCode("0").setData(new Integer(f));
    }
}